#include "aboutwidget.h"
#include "mybtn/backbtn.h"
#include "commondef.h"
#include <QPainter>
#include <QMouseEvent>
#include <QDebug>

AboutWidget::AboutWidget(QWidget *parent) :
    QWidget(parent)
{
    m_backbtn = new BackBtn(this);
    m_backbtn->setGeometry(0,WINDOW_HEIGHT - 60,80,60);
    connect(m_backbtn,SIGNAL(myclick()),this,SLOT(btom()));
}

void AboutWidget::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    p.drawText(QRectF(0.0f,150.0f,360.0f,40.0f),
               Qt::AlignCenter,
               QString(tr("Small sudoku")) + QString(" v1.0.0"));
    p.drawText(QRectF(0.0f,250.0f,360.0f,40.0f),
               Qt::AlignCenter,
               QString(tr("phone")) + QString(" :0532-88773139"));

    p.drawText(QRectF(0.0f,350.0f,360.0f,40.0f),
               Qt::AlignCenter,
               QString(tr("mail")) + QString(" :yige2012@gmail.com"));
}

void AboutWidget::mousePressEvent(QMouseEvent *e)
{
    if(QRectF(0,WINDOW_HEIGHT - 60,80,60).contains(e->posF()))
    {
        emit backtomain();
    }
}

void AboutWidget::btom()
{
    emit backtomain();
}
